#!/usr/bin/env python
# encoding: utf-8
"""
@summary: 验证口碑数据，reducer
@author: hongxingfan
@since: 2014年11月13日    下午4:35:18
"""
import sys

# 分为全部，首页，车型，详情，其他
if __name__ == '__main__':
    
    hash_map = {}
    
    for line in sys.stdin:
        line = line.strip()
        cols = line.split("\t")
        
        key = cols[0]
        pv = int(cols[1])
        suv = cols[2]
        
        if key in hash_map:
            hash_map[key][0] += pv
            hash_map[key][1].add(suv)
        else:
            hash_map[key] = [pv,set([suv])]
            
    for (k,v) in hash_map.items():
        print("%s\t%d\t%d" %(k,v[0],len(v[1])))